import hyRequest from '@/service'
// 用户的网络请求

export function postUserListsData(queryInfo: any) {
  return hyRequest.post({
    url: '/users/list',
    data: queryInfo
  })
}
// 删除用户
export function deleteUserById(id: number) {
  return hyRequest.delete({
    url: `/users/${id}`
  })
}
// 创建新用户
export function addNewUserByForm(userInfo: any) {
  return hyRequest.post({
    url: '/users',
    data: userInfo
  })
}
// 修改用户
export function editUserInfo(id: number, userInfo: any) {
  return hyRequest.patch({
    url: `/users/${id}`,
    data: userInfo
  })
}
// 查询pagelist
export function postPageListsData(pageName: string, queryInfo: any) {
  return hyRequest.post({
    url: `/${pageName}/list`,
    data: queryInfo
  })
}
// 删除pageitembyid
export function deletePageItemById(pageName: string, id: number) {
  return hyRequest.delete({
    url: `${pageName}/${id}`
  })
}
// 新建
export function addNewPageItemByForm(pageName: string, userInfo: any) {
  return hyRequest.post({
    url: `/${pageName}`,
    data: userInfo
  })
}
// 修改page
export function editPageItemByForm(
  pageName: string,
  id: number,
  userInfo: any
) {
  return hyRequest.patch({
    url: `/${pageName}/${id}`,
    data: userInfo
  })
}
